const {daouser,daotittlechildsort,tittlefathersort,daotittle,modeltoken}= require('../../dao/daoenter.js');



const csortchildfid =async (req,res)=>{

    let hahares=await daotittlechildsort.dsortchildfid()
	res.send(hahares)
}



const csortchild =async(req,res)=>{
	/* 从前端数据取出数据封装 */
	let postdate={}
	postdate['sortchild']=req.body.sortchild
	postdate['fufenleiid']=req.body.fufenleiid
	/* 插入数据库 */
	try{
		let rs=await daotittlechildsort.dsortchild (postdate)
		if(rs){
			let pid=rs.fufenleiid
			let zid=rs._id
			let rs2=await tittlefathersort.dsort2(pid,zid)
			res.send({"status":"1",describe:"插入成功"})
	}else{
		res.send({"status":"0",describe:"插入失败"})
	}
	}catch{
		res.send({"status":"0","error":error.message})
	}
	



}



	



module.exports={
csortchildfid,csortchild
	
}
